/**
 * @function 核对个人信息
 * @returns {Boolean}
 */
function checkUserPersoninfoNickname() {
	var userPersoninfoNickname = $('#userPersoninfoNickname').val();
	if(isEmpty(userPersoninfoNickname)) {
		$('#userPersoninfoNicknameError').html('<font style="color: red;">'+ErrorMsgConstants.ERR_INPUT_IS_NOT_ALLOW_NULL+'</font>');
		return false;
	}
	if(!validateInput(userPersoninfoNickname, 2, 10, "0aAC")) {
		$('#userPersoninfoNicknameError').html('<font style="color: red;">'+ErrorMsgConstants.ERR_USERNICKNAME_FORMAT_IS_NOT_VALID+'</font>');
		return false;
	}
	$('#userPersoninfoNicknameError').html('<font style="color: green;">'+ValidMsgConstants.VALID_INPUT+'</font>');
	return true;
}

function checkUserPersoninfoRealname() {
	var userPersoninfoRealname = $('#userPersoninfoRealname').val();
	if(isEmpty(userPersoninfoRealname)) {
		$('#userPersoninfoRealnameError').html('<font style="color: red;">'+ErrorMsgConstants.ERR_INPUT_IS_NOT_ALLOW_NULL+'</font>');
		return false;
	}
	if(!validateInput(userPersoninfoRealname, 2, 10, "C")) {
		$('#userPersoninfoRealnameError').html('<font style="color: red;">'+ErrorMsgConstants.ERR_USERREALNAME_FORMAT_IS_NOT_VALID+'</font>');
		return false;
	}
	$('#userPersoninfoRealnameError').html('<font style="color: green;">'+ValidMsgConstants.VALID_INPUT+'</font>');
	return true;
}

function checkUserPersoninfoAddress(address,addressError) {
	var userPersoninfoAddress = $('#'+address).val();
	if(isEmpty(userPersoninfoAddress)) {
		$('#'+addressError).html('<font style="color: red;">'+ErrorMsgConstants.ERR_INPUT_IS_NOT_ALLOW_NULL+'</font>');
		return false;
	}
	$('#'+addressError).html('<font style="color: green;">'+ValidMsgConstants.VALID_INPUT+'</font>');
	return true;
}

function checkUserPersoninfoCitySelect(){
	var userPersoninfoCitySelect = $("#userPersoninfoCitySelect").val();
	if(userPersoninfoCitySelect == -1){
		$('#userPersoninfoCitySelectError').html('<font style="color: red;">'+ErrorMsgConstants.ERR_USERCITY_FORMAT_IS_NOT_VALID+'</font>');
		return false;
	}
	$('#userPersoninfoCitySelectError').html('<font style="color: green;">'+ValidMsgConstants.VALID_INPUT+'</font>');
	return true;
}

function checkUserPersoninfoPhoneNumber(phoneNumber,phoneNumberError){
	var userPersoninfoPhoneNumber =$('#'+phoneNumber).val();
	var userPersoninfoPhoneNumberHead = userPersoninfoPhoneNumber.substring(0,3);
	var  phoneNumberHead = ["137","136","187","152","150","158","183","151","139","159","147",
			"138","182","157","135","188","134","186","131","130","132","189"];
	var len = phoneNumberHead.length;
	var i = 0;
	if(isEmpty(userPersoninfoPhoneNumber)) {
		$('#'+phoneNumberError).html('<font style="color: red;">'+ErrorMsgConstants.ERR_INPUT_IS_NOT_ALLOW_NULL+'</font>');
		return false;
	}
	if(!validateInput(userPersoninfoPhoneNumber, 11, 11, "0")) {
		$('#'+phoneNumberError).html('<font style="color: red;">'+ErrorMsgConstants.ERR_USERPHONENUMBER_FORMAT_IS_NOT_VALID+'</font>');
		return false;
	}
	$(function(userPersoninfoPhoneNumber){
		for(i ;i < len; i++){
			if(userPersoninfoPhoneNumberHead == phoneNumberHead[i]){
				break ;
			}
		}
		if (i == len) {
			$('#'+phoneNumberError).html('<font style="color: red;">'+ErrorMsgConstants.ERR_USERPHONENUMBER_FORMAT_IS_NOT_VALID+'</font>');
			return false;
		}
		$('#'+phoneNumberError).html('<font style="color: green;">'+ValidMsgConstants.VALID_INPUT+'</font>');
		return true;
		
	});
	
}
/**
 * @function 核对修改密码
 * @returns {Boolean}
 */
function checkUserPersoninfoPassword(password,passwordError) {
	var userPersoninfoPassword = $('#'+password).val();
	if(isEmpty(userPersoninfoPassword)) {
		$('#'+ passwordError).html('<font style="color: red;">'+ErrorMsgConstants.ERR_INPUT_IS_NOT_ALLOW_NULL+'</font>');
		return false;
	}
	if(!validateInput(userPersoninfoPassword, 6, 10, "0aA")) {
		$('#'+ passwordError).html('<font style="color: red;">'+ErrorMsgConstants.ERR_USERPASSWORD_FORMAT_IS_NOT_VALID+'</font>');
		return false;
	}
	$('#'+ passwordError).html('<font style="color: green;">'+ValidMsgConstants.VALID_INPUT+'</font>');
	return true;
}

function checkUserPersoninfoRePassword() {
	var userPersoninfoNewPassword = $('#userPersoninfoNewPassword').val();
	var userPersoninfoRePassword = $('#userPersoninfoRePassword').val();
	
	if(isEmpty(userPersoninfoRePassword)) {
		$('#userPersoninfoRePasswordError').html('<font style="color: red;">'+ErrorMsgConstants.ERR_INPUT_IS_NOT_ALLOW_NULL+'</font>');
		
		return false;
	}
	if(userPersoninfoNewPassword != userPersoninfoRePassword) {
		$('#userPersoninfoRePasswordError').html('<font style="color: red;">'+ErrorMsgConstants.ERR_USERREPASSWORD_IS_NOT_VALID+'</font>');
		$('#userPersoninfoRePassword').val("");
		return false;
	}
	$('#userPersoninfoRePasswordError').html('<font style="color: green;">'+ValidMsgConstants.VALID_INPUT+'</font>');
	return true;
}

/**
 * @function 核对新的收货地址
 * @returns {Boolean}
 */

function checkUserPersoninfoReceiverName() {
	var userPersoninfoReceiverName = $('#userPersoninfoReceiverName').val();
	if(isEmpty(userPersoninfoReceiverName)) {
		$('#userPersoninfoReceiverNameError').html('<font style="color: red;">'+ErrorMsgConstants.ERR_INPUT_IS_NOT_ALLOW_NULL+'</font>');
		return false;
	}
	$('#userPersoninfoReceiverNameError').html('<font style="color: green;">'+ValidMsgConstants.VALID_INPUT+'</font>');
	return true;
}

